﻿using MediatR;
using S.Produce.Domains;
using S.Produce.Infrastructure;
using S.Produce.Read.Api.Application.Commands.BreedingCommands;

namespace S.Produce.Read.Api.Application.CommandHandlers.BreedingCommandHandlers
{
    public class BreedingBackfillCommandHandler : IRequestHandler<breedingBackfillCommand, Breeding>
    {
        private readonly IRepository<Breeding> repository;

        public BreedingBackfillCommandHandler(IRepository<Breeding> repository)
        {
            this.repository = repository;
        }

        public async Task<Breeding> Handle(breedingBackfillCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetAsync(request.Id);
        }
    }
}
